import { IPSSysTestCase } from './ipssys-test-case';
import { IPSSysTestCaseAssert } from './ipssys-test-case-assert';
import { IPSSysTestCaseInput } from './ipssys-test-case-input';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSSysTestCaseAssertImpl extends PSModelObjectImpl implements IPSSysTestCaseAssert {
  get assertTag(): string {
    return this.M.assertTag;
  }

  get assertTag2(): string {
    return this.M.assertTag2;
  }

  get assertTag3(): string {
    return this.M.assertTag3;
  }

  get assertTag4(): string {
    return this.M.assertTag4;
  }

  get assertType(): 'RESULT' | 'EXCEPTION' | 'DATAEXISTS' | 'NOEXCEPTION' | 'CUSTOMCODE' | 'USER' | 'USER2' | 'USER3' | 'USER4' {
    return this.M.assertType;
  }

  get assertValue(): string {
    return this.M.assertValue;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get exceptionName(): string {
    return this.M.exceptionName;
  }

  get exceptionTag(): string {
    return this.M.exceptionTag;
  }

  get exceptionTag2(): string {
    return this.M.exceptionTag2;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected pssystestcaseinput: IPSSysTestCaseInput | null = null;

  getPSSysTestCaseInput(): IPSSysTestCaseInput | null {
    if (this.pssystestcaseinput != null) return this.pssystestcaseinput;
    const value = this.M.getPSSysTestCaseInput;
    if (value == null) {
      return null;
    }
    const ipssystestcase = this.getParentPSModelObject('testing.IPSSysTestCase') as IPSSysTestCase;
    if (ipssystestcase != null) {
      this.pssystestcaseinput = ipssystestcase.findPSSysTestCaseInput(value);
    }
    return this.pssystestcaseinput;
  }

  get psSysTestCaseInput(): IPSSysTestCaseInput | null {
    return this.getPSSysTestCaseInput();
  }

  getPSSysTestCaseInputMust(): IPSSysTestCaseInput {
    const value = this.getPSSysTestCaseInput();
    if (value == null) {
      throw new Error('未指定测试用例输入');
    }
    return value;
  }

  get scriptCode(): string {
    return this.M.scriptCode;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get cls(): string {
    return 'PSSysTestCaseAssertImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'testing.IPSSysTestCaseAssert') return true;
    return super.instanceof(cls);
  }
}
